package com.demo.domain.service;

import com.demo.domain.adapter.IWeiXinPort;
import com.demo.domain.model.WeiXinNoticeFunctionRequest;
import com.demo.domain.model.WeiXinNoticeFunctionResponse;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * 微信通知服务接口
 */
@Slf4j
@Service
public class WeiXinNoticeService {
    @Resource
    private IWeiXinPort weiXinPort;

    @Tool(description = "微信公众号消息通知")
    public WeiXinNoticeFunctionResponse weixinNotice(WeiXinNoticeFunctionRequest request) throws IOException {
        log.info("微信消息通知，平台：{}，主题：{}，描述：{}", request.getPlatform(), request.getSubject(), request.getDescription());
        return weiXinPort.weiXinNotice(request);
    }
}
